var cc__decorate = __decorate;
Object.defineProperty(exports, "__esModule", {
  value: true
});
var cc__decorator = cc._decorator;
var ccp_ccclass = cc__decorator.ccclass;
var ccp_property = cc__decorator.property;
var def_RankBar = /* */function (_cc$Component22) {
  function _ctor() {
    var _this76;
    babel_classCallCheck(this, _ctor);
    _this76 = _callSuper(this, _ctor, arguments);
    _this76.playername = null;
    _this76.score = null;
    _this76.pngarr = [];
    _this76.indexLable = null;
    _this76.turn = null;
    _this76.headImg = null;
    _this76.notOnList = null;
    _this76.cancelPromise = false;
    return _this76;
  }
  babel_inherits(_ctor, _cc$Component22);
  return babel_createClass(_ctor, [{
    key: "onLoad",
    value: function onLoad() {
      this.cancelPromise = false;
    }
  }, {
    key: "onDestroy",
    value: function onDestroy() {
      this.cancelPromise = true;
    }
  }, {
    key: "init",
    value: function init(e, t, n, o) {
      var _this77 = this;
      this.node.getComponent(cc.Animation).play();
      "" == e && (e = "匿名玩家");
      this.playername.string = e;
      console.log("score", t);
      null == t && (t = 0);
      this.score.string = "".concat(t, "次");
      this.indexLable.string = n >= 3 ? "".concat(n + 1) : "";
      this.turn.spriteFrame = this.pngarr[Math.min(n, 3)];
      if (n <= -1) {
        this.notOnList.active = true;
        this.turn.node && (this.turn.node.active = false);
      } else {
        this.notOnList.active = false;
        this.turn.node && (this.turn.node.active = true);
      }
      o && cc.assetManager.loadRemote(o, {
        ext: ".png"
      }, function (e, t) {
        if (e) {
          cc.error(e);
        } else {
          if (_this77.cancelPromise) {
            return;
          }
          _this77.headImg.spriteFrame = new cc.SpriteFrame(t);
        }
      });
    }
  }]);
}(cc.Component);
cc__decorate([ccp_property(cc.Label)], def_RankBar.prototype, "playername", undefined);
cc__decorate([ccp_property(cc.Label)], def_RankBar.prototype, "score", undefined);
cc__decorate([ccp_property(cc.SpriteFrame)], def_RankBar.prototype, "pngarr", undefined);
cc__decorate([ccp_property(cc.Label)], def_RankBar.prototype, "indexLable", undefined);
cc__decorate([ccp_property(cc.Sprite)], def_RankBar.prototype, "turn", undefined);
cc__decorate([ccp_property(cc.Sprite)], def_RankBar.prototype, "headImg", undefined);
cc__decorate([ccp_property(cc.Node)], def_RankBar.prototype, "notOnList", undefined);
def_RankBar = cc__decorate([ccp_ccclass], def_RankBar);
exports.default = def_RankBar;